function getType(obj) {
  let type = typeof obj;
  if (type !== "object") {
    return type;
  }
  return Object.prototype.toString
    .call(obj)
    .replace(/^\[object (\S+)\]$/, "$1");
}

let a = getType([]);
// console.log(a);
let str = "[object Array]";
let str2 = str.replace(/^\[object (\S+)\]$/, "$1");
console.log(str2);
